<template>
    <div class="question-list">
        <h1>问题列表</h1>
    </div>
</template>

<script>
import {getQuestionList} from '../api/question';

export default {
    name:"QuestionList",
    data(){
        return{
            QuestionList:[],
            question:{
                id:'',
                userId:'',
                content:'',
                createDate:'',
            },
        }
    },
    created(){
        this.fetchQuestionList();
    },
    methods:{
        async fetchQuestionList(){
            try {
                const response = await getQuestionList();
                this.QuestionList = response.data || [];
            } catch (error) {
                console.log('Error fetching questionList:',error);
            }
        },
        gotoQuestion(id){
            this.$router.push({path:'/question',query:{id:id}})
        }
    }
    
}
</script>

<style>
    .question-list {
        background-color: aqua;
    }
</style>